package br.com.sipsoft.svola.dirf;
import java.util.HashMap;
import java.util.Map;

public abstract class Dirf {

	String mes[] = { "jan", "fev", "mar", "abr", "mai", "jun", "jul", "agos",
			"set", "out", "nov", "dez", "total", "13" };


	protected double toDouble(String value) {

		value = value.replaceAll("\\\\", "");

		if (value.indexOf(".") >= 0)
			value = value.replaceAll("\\.", "");

		if (value.indexOf(",") >= 0)
			value = value.replaceAll(",", ".");

		return Double.parseDouble(value);
	}

	protected Map<String, Double> parse(String values[]) {

		int i = 0;

		Map<String, Double> retorno = new HashMap<String, Double>();

		for (String v : values) {

			if (v.trim().length() > 0) {
				retorno.put(mes[i], toDouble(v));
				i++;
			}

		}

		return retorno;

	}
	
	

}
